package com.windy.tag;

import java.util.HashMap;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.Component;
import org.apache.struts2.views.jsp.ComponentTagSupport;

import com.opensymphony.xwork2.util.ValueStack;

public class PaginationTag extends ComponentTagSupport {

	private static final long serialVersionUID = -8533312293042810697L;

	private String curPage;
	private String pageSize;
	private String totalRecords;
	private String actionPath;
	private HashMap<Object, Object> paramMap;

	@Override
	public Component getBean(ValueStack stack, HttpServletRequest req,
			HttpServletResponse res) {
		return new Pagination(stack);
	}

	@Override
	protected void populateParams() {
		super.populateParams();
		Pagination tag = (Pagination) component;
		tag.setCurPage(curPage);
		tag.setPageSize(pageSize);
		tag.setTotalRecords(totalRecords);
		tag.setActionPath(actionPath);
		tag.setParamMap(paramMap);
	}

	public void setCurPage(String curPage) {
		this.curPage = curPage;
	}

	public void setPageSize(String pageSize) {
		this.pageSize = pageSize;
	}

	public void setTotalRecords(String totalRecords) {
		this.totalRecords = totalRecords;
	}

	public void setActionPath(String actionPath) {
		this.actionPath = actionPath;
	}

	public void setParamMap(HashMap<Object, Object> paramMap) {
		this.paramMap = paramMap;
	}

}
